<template>
  <div class="app-container">
    <div class="zd3">
      <div class="zd3-title">
        <p>
          <span>制单人</span>
          <input v-model="search.checkPersons" type="text" placeholder="请输入制单人" />
        </p>
        <p>
          <span>单据日期</span>
          <input v-model="search.checkTime" type="text" placeholder="请输入日期" />
        </p>
        <h3 @click="getList">查询</h3>
        <h4 @click="resetList">重置</h4>
				<h3 @click="addPeople" style="background: #0093FF">新增</h3>
      </div>
      <div class="zd3-btm">
        <!-- <div class="addDate" @click="addPeople">+ 新增成员</div> -->
        <el-table :data="tableData" v-loading="loading" style="width: 100%;border-radius: 8px;">
          <el-table-column type="index" align="center" width="50" label="序号" fixed="left" />
          <!-- <el-table-column align="center" width="100" label="单据状态" fixed="left">
            <template slot-scope="scope">
              <div class="orderStatus">
                <p :class="scope.row.status == 0 ? 'blue' : 'green'">
                 {{scope.row.status == 0 ? '已审核' : '审核'}}
                </p>
              </div>
            </template>
          </el-table-column> -->
          <el-table-column align="center" prop="checkId" label="单据号" fixed="left" />
          <el-table-column align="center" prop="checkTime" label="单据日期" fixed="left" />
					<el-table-column align="center" prop="checkPersons" width="100" label="经手人" />
					<!-- <el-table-column align="center" prop="outProtips" label="仓库" /> -->
          <!-- <el-table-column align="center" prop="bumen" width="150" label="经手部门" /> -->
					<el-table-column align="center" prop="checkPersons" width="100" label="制单人" />
					<el-table-column align="center" prop="remarks" label="备注" />
					<el-table-column align="center" prop="insertTime" width="150" label="创建日期" />
          <el-table-column align="center" width="200" label="操作" fixed="right">
            <template slot-scope="scope">
							<el-button type="text" size="small" @click="look(scope.row)">查看</el-button>
              <el-button type="text" size="small" @click="write(scope.row)">编辑</el-button>
              <el-popconfirm
                placement="top"
                hideIcon
                title="是否要删除此行？"
                @onConfirm="deleteRow(scope.row)"
              >
                <el-button type="text" size="small" slot="reference">删除</el-button>
              </el-popconfirm>
            </template>
          </el-table-column>
        </el-table>
        <el-pagination
          background
          hide-on-single-page
          layout="prev, pager, next"
          :total="total"
          @prev-click="goPrev"
          @next-click="goNext"
        />
      </div>
    </div>
  </div>
</template>

<script>
import { getPandianTitle, getPandianAll, addPandian, updatePandian, deletePandian, deletePandianNew } from '@/api/cangku'
export default {
  data() {
    return {
      search: {},
      total: 1,
      showHeader: false,
			loading: true,
      // options: regionData,
      selectedOptions: [],
			queryList:[
				{
					label: '本年单据',
					value: 1
				},
				{
					label: '本月单据',
					value: 2
				},
				{
					label: '本周单据',
					value: 3
				},
				{
					label: '本日单据',
					value: 4
				}
			],
      tableData: [],
      dialogVisible: false,
      tempData: '',
      tempIndex: -1,
      options: [
        {
          label: '不限',
          value: '0'
        },
        {
          label: '供应商',
          value: '1'
        },
        {
          label: '客户',
          value: '2'
        }
      ],
      value: '',
      djtime: ''
    }
  },
	mounted() {
		this.getList()
	},
  methods: {
    getList() {
			getPandianTitle(this.search).then(res => {
				console.log(res)
				this.tableData = res.data
				this.loading = false
			})
		},
    write(item, index) {
      console.log(item)
      this.$router.push({ name: "ChecklistWrite",params:{options: JSON.stringify(item)}})
    },
    save(item) {},
    deleteRow(item) {
      console.log("删除")
			console.log(item)
			deletePandianNew(item.checkUuid).then(res => {
				console.log(res)
				this.$message({
					message: res.message,
					type: 'success'
				})
			})
			this.getList()
    },
		look(item){
			this.$router.push({ 
				name: "ChecklistWrite",
				params:{
					options: JSON.stringify(item),
					look: true
				},
			})
		},
    goPrev(page) {
      console.log(page)
    },
    goNext(page) {
      console.log(page)
    },
    resetList() {
      this.search = {}
    },
    addPeople(item) {
      this.$router.push({ name: "ChecklistWrite" })
    }
  }
}
</script>

<style lang="scss" scoped>
/deep/.el-button--primary {
  color: #fff;
  background-color: #18a05e !important;
  border-color: #18a05e !important;
}
/deep/.el-button--primary:hover,
.el-button--primary:focus {
  background: #18a05e !important;
  border-color: #18a05e !important;
  color: #fff !important;
}
/deep/.el-button:hover,
.el-button:focus {
  color: #18a05e;
  background-color: transparent;
}
/deep/.el-button--primary {
  color: #fff;
  background-color: #18a05e;
  border-color: #18a05e;
}
/deep/.el-button--text {
  color: #00c666 !important;
}
.app-container {
  padding: 10px;
}
.orderStatus {
  display: flex;
	justify-content: center;
  > p {
    padding: 0px 5px;
    color: #fff;
    border-radius: 2px;
		font-size: 14px;
    // margin: 0 10px 0 0;
  }
  .blue {
    background: #3a87ad;
  }
  .green {
    background: #18a05e;
  }
  .yellow {
    background: #ff7a0e;
  }
  .red {
    background: #c60000;
  }
}

.status {
  border-radius: 3px;
  font-size: 14px;
  width: 50px;
  color: #fff;
  background: #777777;
  margin: 0 auto;
}
.status-active {
  background: #18a05e;
}
.inps {
  width: 100%;
  height: 32px;
  line-height: 32px;
  padding-left: 10px;
  background: none;
  border: none;
  color: #333;
}
.inps-active {
  width: 100%;
  height: 32px;
  line-height: 32px;
  padding-left: 10px;
  // background:#ccc;
  border: none;
  color: #333;
}
.zd3-title {
	height: 80px;
	display: flex;
	align-items: center;
	padding: 0 20px;
	position: relative;
	background: #ffffff;
	border-radius: 8px;
	border: 1px solid rgba(0, 0, 0, 0.1);

	> p {
		font-size: 14px;
		color: #333;
		margin-right: 30px;

		> span {
			padding-right: 20px;
		}

		> input {
			width: 200px;
			height: 32px;
			// background: #ccc;
			border-radius: 3px;
			border: 1px solid #ccc;
			padding-left: 10px;
			color: #333;
		}
	}

	> h3 {
		width: 64px;
		height: 32px;
		background: #18a05e;
		border-radius: 3px;
		margin: 0 30px 0 0;
		color: #fff;
		font-size: 14px;
		line-height: 32px;
		font-weight: 100;
		text-align: center;
		cursor: pointer;
	}

	> h4 {
		width: 64px;
		height: 32px;
		border-radius: 3px;
		border: 1px solid rgba(0, 0, 0, 0.1);
		color: #333;
		font-size: 14px;
		line-height: 32px;
		font-weight: 100;
		text-align: center;
		cursor: pointer;
		margin-right: 30px;
	}
}
.zd3-btm .btn-prev:after {
  content: "上一页";
}
.zd3-btm .btn-next:before {
  content: "下一页";
}
.zd3-btm .btn-prev,
.zd3-btm .btn-next {
  width: 65px;
}
.zd3-btm {
  background: rgba(255, 255, 255, 1);
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  margin-top: 10px;
  overflow: hidden;
  &-title {
    display: flex;
    align-items: center;
    height: 70px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: #ffffff;
    > p {
      text-align: center;
      font-size: 16px;
      color: #333;
    }
  }
  .el-pagination {
		white-space: nowrap;
		padding: 15px 5px;
		color: #303133;
		font-weight: bold;
	}
  .addDate {
    margin: 20px 32px 10px 32px;
    height: 32px;
    border-radius: 3px;
    text-align: center;
    line-height: 32px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    border: 1px dashed rgba(0, 0, 0, 0.25);
  }
  .el-button--text {
    margin: 0 15px;
  }
}
.change {
  display: flex;
  flex-wrap: wrap;
  > p {
    width: 50%;
    font-size: 14px;
    display: flex;
    align-items: center;
    color: #333;
    /deep/.el-input__inner {
      width: inherit;
      background: none;
      height: 32px;
      // line-height: 32px;
      color: #333;
      border: 1px solid rgba(0, 0, 0, 0.1);
      padding: 0 25px;
    }
    /deep/.el-input__icon {
      line-height: 32px;
    }
    .userselect {
      // max-width: 250px;
      flex: 1;
    }

    > span {
      display: block;
      width: 120px;
      text-align: right;
      padding-right: 15px;
    }
    > input {
      width: inherit;
      flex: 1;
      height: 32px;
      border-radius: 3px;
      border: 1px solid rgba(0, 0, 0, 0.1);
      padding-left: 10px;
      color: #333;
    }
  }
}
</style>
